package com.zp.self.module.level_5_设计模式.行为型模式.Ⅹ_备忘录模式.黑箱模式;


import java.util.HashMap;
import java.util.Map;

/**
 * @author ：by Zeng Peng
 * @date ：Created 2022/7/7 20:55
 * @description ：
 */
public class RoleStateCaretaker {
    Map<String, Memorandum> map =new HashMap<>();

    public void setRoleState(String version, Memorandum roleStateMemorandum){
        map.put(version,roleStateMemorandum);
    }

    public Memorandum getRoleState(String version){
        Memorandum roleStateMemorandum = map.get(version);
        if(roleStateMemorandum==null)
            throw new RuntimeException("未找到对应存档！");
        else
            return roleStateMemorandum;
    }


}
